In a known compression technique, image data representing an image including text is compressed in accordance with a compression degree (e.g., one of high compression, medium compression, and low compression) specified by a user. In the known technique, when the high compression is specified and black characters of the text included in the image are regarded as important, the image data is segmented into a foreground layer representing the text and a background layer representing a background other than the text. The foreground layer is compressed using a lossless compression method and the background layer is compressed using a lossy compression method. When one of the medium compression and the low compression is specified or when the black characters of the text are not regarded as important, the image data is compressed using the lossy compression method without being segmented into the foreground layer and the background layer.